<div class="issue-priority-edit container-fluid">

  <div class="row">
    <div class="edit-toolbar col-xl-12">
      <div class="title">
        <span *ngIf="!model?.id">新建优先级</span>
        <span *ngIf="model?.id">编辑优先级</span>
      </div>
      <div class="buttons">
        <button (click)="back()" type="button"
                class="btn btn-secondary btn-with-icon btn-sm back">
          <i class="fa fa-arrow-circle-left"></i>返回
        </button>
      </div>
    </div>
  </div>
  <hr/>

  <form [formGroup]="form" class="my-validate-form">
      <div class="form-group row">
        <label class="col-sm-2 col-form-label"><span>名称</span></label>
        <div class="col-sm-10">
          <input type="text" class="form-control" name="label" formControlName="label"
                 [(ngModel)]="model.label" #label>
        </div>
      </div>
    <!--<div class="form-group row">
      <label class="col-sm-2 col-form-label"><span>取值</span></label>
      <div class="col-sm-10">
        <input type="text" class="form-control" name="value" formControlName="value"
               [(ngModel)]="model.value" #value>
      </div>
    </div>-->

    <div class="form-group row">
      <label class="col-sm-2 col-form-label"><span>描述</span></label>
      <div class="col-sm-10">
        <textarea type="text" class="form-control" name="descr" formControlName="descr" rows="3"
                  [(ngModel)]="model.descr" #descr></textarea>
      </div>
    </div>
    <div class="form-group row just-label">
      <label class="col-sm-2 col-form-label"><span>是否默认</span></label>
      <label class="col-sm-4 col-form-label left">
        {{model.defaultVal | trueOrFalse}}
      </label>

      <label class="col-sm-2 col-form-label"><span>是否內置</span></label>
      <label class="col-sm-4 col-form-label left">
        {{model.buildIn | trueOrFalse}}
      </label>
    </div>

    <div class="form-group row">
      <label class="col-sm-2 col-form-label"></label>
      <div class="col-sm-10">
        <button (click)="save()" type="button" class="btn btn-primary" [disabled]="!form.valid">保存</button>
        &nbsp;
        <button (click)="back()" type="button" class="btn btn-default">取消</button>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <button (click)="showModal()" *ngIf="model.id && !model.buildIn" type="button" class="btn btn-danger">删除</button>
      </div>
    </div>

    <div class="form-group row">
      <label class="col-sm-2 col-form-label"></label>
      <div class="col-sm-10">
        <div class="validate-errors">
          <div class="validate-error" *ngFor="let msg of formErrors">
            <div>{{ msg }}</div>
          </div>
        </div>
      </div>
    </div>

  </form>

</div>

<pop-dialog #modalWrapper (confirm)="delete()" [title]="'提示'">
  确认删除名为"{{model.label}}"的用例优先级?
</pop-dialog>
